home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / WINDOWS / EZNET.ZIP / DEMO.ZIP / DIAGRAM.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-10-31  |  5.7 KB  |  208 lines

  1. VERSION 4.00
  2. Begin VB.Form Form3 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Example 3: Diagrams"
  6.    ClientHeight    =   3765
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   5445
  10.    FillColor       =   &H0000FFFF&
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   0
  14.       weight          =   700
  15.       size            =   8.25
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   4170
  22.    Left            =   1035
  23.    LinkTopic       =   "Form3"
  24.    MDIChild        =   -1  'True
  25.    ScaleHeight     =   3765
  26.    ScaleWidth      =   5445
  27.    Tag             =   "3"
  28.    Top             =   1140
  29.    Width           =   5565
  30.    Begin EasynetLib.Easynet Net1 
  31.       Height          =   3465
  32.       Left            =   150
  33.       TabIndex        =   0
  34.       Top             =   120
  35.       Width           =   4665
  36.       _Version        =   65538
  37.       _ExtentX        =   8229
  38.       _ExtentY        =   6112
  39.       _StockProps     =   101
  40.       BackColor       =   16777088
  41.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          name            =   "MS Sans Serif"
  43.          charset         =   0
  44.          weight          =   400
  45.          size            =   8.25
  46.          underline       =   0   'False
  47.          italic          =   0   'False
  48.          strikethrough   =   0   'False
  49.       EndProperty
  50.       BorderStyle     =   1
  51.       xGrid           =   11
  52.       yGrid           =   11
  53.       Shape           =   0
  54.       FillColor       =   16777215
  55.       DrawColor       =   255
  56.       ForeColor       =   0
  57.       DrawWidth       =   1
  58.       Oriented        =   -1  'True
  59.       ReadOnly        =   0   'False
  60.       MultiSel        =   -1  'True
  61.       ScrollBars      =   3
  62.       CanDrawNode     =   -1  'True
  63.       CanDrawLink     =   -1  'True
  64.       CanMoveNode     =   -1  'True
  65.       CanSizeNode     =   -1  'True
  66.       CanStretchLink  =   -1  'True
  67.       CanMultiLink    =   -1  'True
  68.       Transparent     =   0   'False
  69.       DrawStyle       =   6
  70.       Alignment       =   7
  71.       ShowGrid        =   -1  'True
  72.       LinkHead        =   0
  73.       DoSelChange     =   -1  'True
  74.       DoAddNode       =   -1  'True
  75.       DoAddLink       =   -1  'True
  76.       Hiding          =   0   'False
  77.       ImageFile       =   ""
  78.       DisplayHandles  =   -1  'True
  79.       Zoom            =   100
  80.       AutoSize        =   0
  81.       AutoScroll      =   -1  'True
  82.    End
  83. Attribute VB_Name = "Form3"
  84. Attribute VB_Creatable = False
  85. Attribute VB_Exposed = False
  86. Option Explicit
  87. Dim n%, flag%
  88. Dim Node(1 To 4) As Long
  89. Dim X0&, Y0&
  90. Private Sub banner3()
  91.   With Net1
  92.     .AddNodeItem
  93.     .X1 = 600
  94.     .Y1 = 200
  95.     .X2 = .X1 + 500
  96.     .Y2 = .Y1 + 500
  97.     .Transparent = False
  98.     Node(1) = .item
  99.     .AddNodeItem
  100.     .X1 = 2100
  101.     .Y1 = 200
  102.     .X2 = .X1 + 500
  103.     .Y2 = .Y1 + 500
  104.     Node(2) = .item
  105.     .AddNodeItem
  106.     .X1 = 1600
  107.     .Y1 = 1700
  108.     .X2 = .X1 + 500
  109.     .Y2 = .Y1 + 500
  110.     Node(3) = .item
  111.     .AddNodeItem
  112.     .X1 = 100
  113.     .Y1 = 1700
  114.     .X2 = .X1 + 500
  115.     .Y2 = .Y1 + 500
  116.     Node(4) = .item
  117.     .AddLinkItem Node(1), Node(2)
  118.     .AddLinkItem Node(2), Node(3)
  119.     .AddLinkItem Node(3), Node(4)
  120.     .AddLinkItem Node(1), Node(4)
  121.     .AddLinkItem Node(1), Node(3)
  122.     .item = 0
  123.   End With
  124. End Sub
  125. Private Sub Form_Activate()
  126.   ActivateForm
  127. End Sub
  128. Private Sub Form_Deactivate()
  129.   DeactivateForm
  130. End Sub
  131. Private Sub Form_Load()
  132.   MDI1.ShowExample(2).Enabled = False
  133.   n = 1
  134.   flag = False
  135.   Net1.Left = 0
  136.   Net1.Top = 0
  137.   SpeedON Net1
  138.   banner3
  139.   SpeedOFF Net1
  140. End Sub
  141. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  142.   CursorShape Net1
  143. End Sub
  144. Private Sub Form_Resize()
  145.   If WindowState <> 1 And ScaleHeight <> 0 Then
  146.     Net1.Height = ScaleHeight
  147.     Net1.Width = ScaleWidth
  148.   End If
  149. End Sub
  150. Private Sub Form_Unload(Cancel As Integer)
  151.   MDI1.ShowExample(2).Enabled = True
  152.   MDI1.Command5.Enabled = False
  153.   MDI1.Command5.Caption = "Comments "
  154. End Sub
  155. Private Sub Net1_AddLink()
  156.   If flag = True Then
  157.     flag = False
  158.   End If
  159. End Sub
  160. Private Sub Net1_AddNode()
  161.   ' Avoid too small nodes
  162.   If Net1.X2 - Net1.X1 < 500 Then Net1.X2 = Net1.X1 + 500
  163.   If Net1.Y2 - Net1.Y1 < 500 Then Net1.Y2 = Net1.Y1 + 500
  164.   Net1.Text = Str(n)
  165.   n = n + 1
  166. End Sub
  167. Private Sub Net1_KeyDown(KeyCode As Integer, Shift As Integer)
  168.   If KeyCode = KEY_DELETE Then
  169.     Net1.DeleteSel
  170.   End If
  171. End Sub
  172. Private Sub Net1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  173.   If Net1.PointedArea = 5 Then
  174.     flag = True
  175.     X0 = X
  176.     Y0 = Y
  177.   End If
  178. End Sub
  179. Private Sub Net1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  180.   CursorShape Net1
  181. End Sub
  182. Private Sub Net1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  183.   Dim Xabs, Yabs As Single
  184.   Dim org&, dst&
  185.   If flag = True Then
  186.     flag = False
  187.     If (Abs(X - X0) < 300 And Abs(Y - Y0) < 300) Then
  188.       Exit Sub
  189.     End If
  190.     ' Origin node of next created link
  191.     org = Net1.item
  192.     ' No current item
  193.     Net1.item = 0
  194.     Xabs = X + Net1.xScroll
  195.     Yabs = Y + Net1.yScroll
  196.     ' Create destination node
  197.     Net1.X1 = Xabs - 300
  198.     Net1.X2 = Xabs + 300
  199.     Net1.Y1 = Yabs - 300
  200.     Net1.Y2 = Yabs + 300
  201.     Net1.AddNodeItem
  202.     ' Destination node of next created link
  203.     dst = Net1.item
  204.     ' Create link
  205.     Net1.AddLinkItem org, dst
  206.   End If
  207. End Sub
  208.